#pragma once
#include <list>
#include "Particle.h"
#include "string"
using namespace std;

class  CParticleFlyweight;
class BaseToken;
//class CParticle;

class IEmitter
{



protected:
	float m_fHeight;
	float m_fWidth;
	float m_fPosX;
	float m_fPosY;
	float m_fSpawnRate;
	float m_fSpawnTimer;
	int m_nMaxParticles;
	bool m_bForward;
	

	bool m_bIsLooping;
	bool m_bActive;

	string m_szName;

	CParticleFlyweight* m_pFLW;
	BaseToken* m_pTokenToTrack;
	
	list<CParticle> m_LiveParticles;
	list<CParticle> m_DeadParticles;

	
public:
	IEmitter(void);
	virtual ~IEmitter(void);

	virtual void Update( float fElapsedTime );
	virtual void SpawnParticles(int maxParticles, float minPosX, float maxPosX, float minPosY, float maxPosY);
	virtual void CalcEmitRange(float& MINPOSX, float& MAXPOSX, float& MINPOSY, float& MAXPOSY, float& endX, float& endY);
	virtual float CalcLifetime();
	virtual void StartEmission();
	virtual void EndEmission();
	virtual void Render();


	bool Forward() const { return m_bForward; }
	void Forward(bool val) { m_bForward = val; }
	float PosX() const { return m_fPosX; }
	void PosX(float val) { m_fPosX = val; }
	float PosY() const { return m_fPosY; }
	void PosY(float val) { m_fPosY = val; }
	float Height() const { return m_fHeight; }
	void Height(float val) { m_fHeight = val; }
	float Width() const { return m_fWidth; }
	void Width(float val) { m_fWidth = val; }
	bool IsLooping() const { return m_bIsLooping; }
	void IsLooping(bool val) { m_bIsLooping = val; }
	float SpawnRate() const { return m_fSpawnRate; }
	void SpawnRate(float val) { m_fSpawnRate = val; }
	int MaxParticles() const { return m_nMaxParticles; }
	void MaxParticles(int val) { m_nMaxParticles = val; }

	const char * Name() const { return m_szName.c_str(); }
	void Name(const char* val);

	CParticleFlyweight * Flyweight() const { return m_pFLW; }
	void Flyweight(CParticleFlyweight * val) { m_pFLW = val; }

	BaseToken* TokenToTrack() const { return m_pTokenToTrack; }
	void TokenToTrack(BaseToken* val) { m_pTokenToTrack = val; }

	list<CParticle> LiveParticles() const { return m_LiveParticles; }
	void LiveParticles(list<CParticle> val) { m_LiveParticles = val; }
	list<CParticle> DeadParticles() const { return m_DeadParticles; }
	void DeadParticles(list<CParticle> val) { m_DeadParticles = val; }

};

